Another fix for the initial focus heuristic
authorMatthias Clasen <mclasen@redhat.com>
Sun, 19 Sep 2010 04:54:50 +0000 (00:54 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 19 Sep 2010 04:54:50 +0000 (00:54 -0400)
We were trying to avoid selecting a label initially, but the code
was sometimes leaving labels selected when the focus eventually
ended up on a button instead.

gtk/gtkdialog.c

index 169eb2921496ca2fcc4abb9e3cf5cc0de69e214d..86e28e320d3d37fedab7b504743a3550d1812d93 100644 (file)
@@ -346,15 +346,15 @@ gtk_dialog_map (GtkWidget *widget)
           g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
 
           focus = gtk_window_get_focus (window);
+          if (GTK_IS_LABEL (focus) &&
+              !gtk_label_get_current_uri (GTK_LABEL (focus)))
+            gtk_label_select_region (GTK_LABEL (focus), 0, 0);
+
           if (first_focus == NULL)
             first_focus = focus;
           else if (first_focus == focus)
-            {
-              if (GTK_IS_LABEL (focus) &&
-                  !gtk_label_get_current_uri (GTK_LABEL (focus)))
-                gtk_label_select_region (GTK_LABEL (focus), 0, 0);
-              break;
-            }
+            break;
+
           if (!GTK_IS_LABEL (focus))
             break;
         }